package com.hongdee.market.grievance.mapper;

import com.hongdee.market.grievance.pojo.TMarketWhinePojo;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * Created by Liu XiaoLong
 * Date: 2017/10/27.
 * Remark:
 */
@Mapper
public interface ITMarketWhineMapper {

    @SelectProvider(type = TMarketWhineQuery.class,method = "list")
    @Results({
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "sa", property = "sa"),
            @Result(column = "vin", property = "vin"),
            @Result(column = "plate_num", property = "plateNum"),
            @Result(column = "owner", property = "owner"),
            @Result(column = "owner_phone", property = "ownerPhone"),
            @Result(column = "type", property = "type"),
            @Result(column = "content", property = "content"),
            @Result(column = "node", property = "node"),
            @Result(column = "submit_time", property = "submitTime"),
            @Result(column = "degree", property = "degree"),
            @Result(column = "status", property = "status")

    })
    List<TMarketWhinePojo> list(@Param("node") String node,@Param("data") Map data);


    @Update("update t_market_whine set node= #{status} where id = #{id}")
    void updateNode(@Param("status") String status,@Param("id") String id);

    @Update("update t_market_whine set status= #{status} where id = #{id}")
    void updateStatus(@Param("status") String status,@Param("id") String id);

    @Update("update t_market_whine set degree= #{degree} , type = #{type} where id = #{id}")
    void updateDegree(@Param("degree") String degree,@Param("type") String type,@Param("id") String id);

    @Select("select * from t_market_whine where id = #{id}")
    @Results({
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "sa", property = "sa"),
            @Result(column = "vin", property = "vin"),
            @Result(column = "plate_num", property = "plateNum"),
            @Result(column = "owner", property = "owner"),
            @Result(column = "owner_phone", property = "ownerPhone"),
            @Result(column = "type", property = "type"),
            @Result(column = "node", property = "node"),
            @Result(column = "submit_time", property = "submitTime"),
            @Result(column = "status", property = "status"),
            @Result(column = "degree", property = "degree"),
            @Result(column = "content", property = "content")
    })
    TMarketWhinePojo Info(@Param("id") String id);

}
